#include"../include/cmd.h"

int pwd_command(int fd,cmd_t* cmd)
{
    char buf[200]={0};
    char* pret=getcwd(buf,sizeof(buf));
    if(NULL==pret)
    {
        perror("getcwd");
        return -1;
    }

    //通过小火车发送当前工作路径
    train_t train;
    memset(&train,0,sizeof(train));
    train.length=strlen(buf);
    strcpy(train.buff,buf);
    
    //小火车一次性发送pwd内容
    int ret=send(fd,&train,4+train.length,MSG_WAITALL);
    return ret;   
}
